#include <stdio.h>
#include <math.h>

void draw(int n) {
    int layer = 0;
    int count = n;
    int counts[100];
    while (count > 0) {
        int layer_count = (layer + 1) * 2 - 1;
        int layer_num = count > layer_count ? layer_count : count;
        counts[layer] = layer_num;
        count -= layer_count;
        layer++;
    }
    
    int sp = layer * 2;
    for (int j = 0; j < sp; j++) {
        putchar(' ');
    }
    puts("*");
    for (int i = 0; i < layer; i++) {
        int sp = (layer - i) * 2 - 2;
        for (int j = 0; j < sp; j++) {
            putchar(' ');
        }
        int dir = 0;
        for (int j = 0; j < counts[i] + 1; j++) {
            dir = !dir;
            if (dir) {
                printf(" /");
            } else {
                printf(" \\");
            }
        }
        putchar('\n');
        for (int j = 0; j < sp; j++) {
            putchar(' ');
        }
        int hor = counts[i] % 2 == 1 ? counts[i] / 2 + 1 : counts[i] / 2;
        for (int j = 0; j < hor + 1; j++) {
            if (j != 0) {
                printf(" - *");
            } else {
                printf("*");
            }
        }
        putchar('\n');
    }
}

int main(void) {
    int t;
    scanf("%d", &t);
    for(int i = 0; i < t; i++) {
        int n;
        scanf("%d", &n);
        draw(n);
    }
    return 0;
}
